package com.woniu.apipassenger.config;

import lombok.Data;
import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
//@ConfigurationProperties(prefix = "spring.redis")
@Data
public class RedissonConfig {

    private Integer database;

    private String host;

    private Integer port;

    private String password;
    @Bean
    public RedissonClient redissonClient() {
        Config config = new Config();
        config.useSingleServer()
                .setAddress("redis://"+"43.142.246.250"+":"+6378)
                .setPassword("rui123456")
                .setDatabase(0);
        return Redisson.create(config);
    }
//    @Bean
//    public RedissonClient redissonClient() {
//        Config config = new Config();
//        config.useSingleServer()
//                .setDatabase(database)
//                .setAddress("redis://" + host + ":" + port);
//        RedissonClient redisson = Redisson.create(config);
//        return redisson;
//    }
}
